<?php
class Index_con extends Lxbase{
	public $vqconn;
	public $pla;
	public $plarr;
	public function __construct(){
		parent::__construct();
		$vqdbary = Lxbase::getconfig("olddb");
		$this->vqconn=new Lxbase($vqdbary);
		$this->plarr = array(4=>array("name"=>"微信公众号","a"=>"wxpla"),9=>array("name"=>"独立APP","a"=>"apppla"),13=>array("name"=>"移动站","a"=>"companys"));
		$this->pla=intval($_GET["pla"]);
   }
   //网站总览
	public function index(){
		$this->smarty->assign("tit",'网站总览');
		$this->smarty->assign("navstyle",array("all"=>'class="sel"'));
		$this->smarty->assign("pla",$this->pla);
		$this->smarty->assign("planame",$this->plarr[$this->pla]);
		$this->smarty->assign("basehost",$this->basehost);
		$this->smarty->assign("u",$this->userinfo['userid']);
        $three_domain = $this->viewdata('three_domain','users','where id = ' . $this->userinfo['userid'])['three_domain'];
        $this->smarty->assign("three_domain",$three_domain);
		$this->smarty->display("index.tpl");
	}
	//设置首页
	public function setindex(){
		if(!empty($_POST)){
			$title=$_POST["title"];
			$indextit=$_POST["indextit"];
			$listtit=$_POST["listtit"];
			$navname=$_POST["navname"];
			$navurl=$_POST["navurl"];
			$navid=$_POST["navid"];
			if(empty($navname)){die(jsfshow('请填写网站导航'));}
			$j=0;
			foreach($navname as $k=>$v){
				if(empty($navurl[$k])){
					die(jsfshow("请填写第{$k}个导航的链接"));
				}
				$navinfo[$j]["name"] = $navname[$k];
				$navinfo[$j]["url"] = $navurl[$k];
				$navinfo[$j]["id"] = $navid[$k];
				$j++;
			}
			$nav = base64_encode(serialize($navinfo));
			$pic=$_POST["pic"];
			$picid=$_POST["picid"];
			if(empty($pic) || count($pic)<1){die(jsfshow('请选择首页幻灯片'));}
			$j=0;
			foreach($pic as $k=>$v){
				if(empty($v)){die(jsfshow('请填写第'.$k.'条幻灯片'));}
				$picinfo[$j]["url"] = $pic[$k];
				$picinfo[$j]["id"] = $picid[$k];
				$j++;
			}
			$flash = base64_encode(serialize($picinfo));
			$tpnews=$_POST["tpnews"];
			$tpid=$_POST["tpid"];
			if(empty($tpnews)){die(jsfshow('请选择推荐文章'));}
			$j=0;
			foreach($tpnews as $k=>$v){
				$tpinfo[$j]["url"] = $tpnews[$k];
				$tpinfo[$j]["id"] = $tpid[$k];
				$j++;
			}
			$news = base64_encode(serialize($tpinfo));
			$adname=$_POST["adname"];
			$adurl=$_POST["adurl"];
			if(!empty($adname)){
				$j=0;
				foreach($adname as $k=>$v){
					if(empty($adurl[$k])){
						die(jsfshow('请填写第'.$k.'个友情链接的链接地址'));
					}
					$adinfo[$j]["name"] = $adname[$k];
					$adinfo[$j]["url"] = $adurl[$k];
					$j++;
				}
				$ad=base64_encode(serialize($adinfo));
			}else{
				$ad='';
			}
			$into="title='{$title}',indextit='{$indextit}',listtit='{$listtit}',nav='{$nav}',flash='{$flash}',news='{$news}',ad='{$ad}'";
			$ishave = $this->viewdata("id","pcindex","where userid={$this->userinfo['userid']}");
			if(!empty($ishave)){
				$this->updata("pcindex",$into,"where id={$ishave['id']}");
			}else{
				$usertoken = $this->oncedata("token","users","where id={$this->userinfo['userid']}");
				$into.=",userid={$this->userinfo['userid']},token='{$usertoken}'";
				$this->setdata("pcindex",$into);
			}
			die(jsfshow('首页设置完成'));
		}
		$view = $this->viewdata("*","pcindex","where userid={$this->userinfo['userid']}");
		if(!empty($view)){
			if(!empty($view["nav"])){
			$navinfo = unserialize(base64_decode($view["nav"]));
			$this->smarty->assign("navinfo",$navinfo);
			$this->smarty->assign("navnum",count($navinfo)+1);
			}
			if(!empty($view["flash"])){
			$flashinfo = unserialize(base64_decode($view["flash"]));
			$this->smarty->assign("flashinfo",$flashinfo);
			$this->smarty->assign("flashnum",count($flashinfo)+1);
			}
			if(!empty($view["news"])){
			$newsinfo = unserialize(base64_decode($view["news"]));
			$this->smarty->assign("newsinfo",$newsinfo);
			$this->smarty->assign("newsnum",count($newsinfo)+1);
			}
			if(!empty($view["ad"])){
			$adinfo = unserialize(base64_decode($view["ad"]));
			$this->smarty->assign("adinfo",$adinfo);
			$this->smarty->assign("adnum",count($adinfo)+1);
			}
			$this->smarty->assign("view",$view);
		}
		$this->smarty->assign("tit",'首页设置');
		$this->smarty->assign("navstyle",array("index"=>'class="sel"'));
		$this->smarty->assign("pla",$this->pla);
		$this->smarty->assign("planame",$this->plarr[$this->pla]);
		$this->smarty->display("setindex.tpl");
	}
	//模板设置
	public function settpl(){
		$view = $this->viewdata("*","pctpl","where userid={$this->userinfo['userid']}");
		if(!empty($view)){
			$this->smarty->assign("view",$view);
		}
		$this->smarty->assign("tit",'模板设置');
		$this->smarty->assign("navstyle",array("tpl"=>'class="sel"'));
		$this->smarty->assign("pla",$this->pla);
		$this->smarty->assign("planame",$this->plarr[$this->pla]);
		$this->smarty->display("tpl.tpl");
	}
	public function savetpl(){
		$tid=intval($_GET["tid"]);
		$ishave = $this->viewdata("id","pctpl","where userid={$this->userinfo['userid']}");
		if(!empty($ishave)){
			$this->updata("pctpl","tid={$tid}","where userid={$this->userinfo['userid']}");
		}else{
			$this->setdata("pctpl","tid={$tid},userid={$this->userinfo['userid']}");
		}
		echo "<script>alert('模板设置成功');parent.location.href='?g=pc&a=settpl'</script>";
		exit;
	}
	//列表页设置
	public function setlist(){
		if(!empty($_POST)){
			$pagesize=intval($_POST["pagesize"]);
			$istext=intval($_POST["istext"]);
			$isclass=intval($_POST["isclass"]);
			$ispic=intval($_POST["ispic"]);
			$iswriter=intval($_POST["iswriter"]);
			$istim=intval($_POST["istim"]);
			$into="userid={$this->userinfo['userid']},pagesize={$pagesize},istext={$istext},isclass={$isclass}";
			$into.=",ispic={$ispic},iswriter={$iswriter},istim={$istim}";
			$ishave=$this->viewdata("id","pclist","where userid={$this->userinfo['userid']}");
			if(!empty($ishave)){
				$this->updata("pclist",$into,"where id={$ishave['id']}");
			}else{
				$this->setdata("pclist",$into);
			}
			die(jsfshow('列表页设置完成'));
		}
		$view = $this->viewdata("*","pclist","where userid={$this->userinfo['userid']}");
		if(!empty($view)){$this->smarty->assign("view",$view);}
		$this->smarty->assign("tit","列表页设置");
		$this->smarty->assign("navstyle",array("list"=>'class="sel"'));
		$this->smarty->assign("pla",$this->pla);
		$this->smarty->assign("planame",$this->plarr[$this->pla]);
		$this->smarty->display("setlist.tpl");
	}
	
	//PC站
	public function showindex(){
		$userid=intval($_GET["u"]);
		$usertoken = $this->oncedata("token","users","where id={$userid}");
		$urlhost = empty($_SERVER["SERVER_NAME"])?$_SERVER["HTTP_HOST"]:$_SERVER["SERVER_NAME"];
		if($urlhost == 'qiyue.zhongsou.com' || $urlhost=='qiyuenew.zhongsou.com'){
			$vqbasehost = 'http://vq.zhongsou.com/';
		}else{
			$vqbasehost = 'http://kaifa.vq.zhongsou.com/';
		}
		$view = $this->viewdata("*","pcindex","where userid={$userid}");
		if(empty($view)){
			header("location:".$this->basehost);
			exit;
		}
		if(empty($view["indextit"])){$view["indextit"]='首页';}
		if(empty($view["listtit"])){$view["listtit"]='行业资讯';}
		$navinfo = unserialize(base64_decode($view["nav"]));
		if(!empty($navinfo)){
			foreach($navinfo as $k=>$v){
				if(!empty($navinfo[$k]["id"])){
					if($navinfo[$k]["url"]=='list'){
						$navinfo[$k]["url"] = "?g=pc&a=showlist&u={$userid}&cid={$navinfo[$k]['id']}";
					}elseif(!empty($v["id"])){
						$navinfo[$k]["url"] = "?g=pc&a=showview&u={$userid}&id={$navinfo[$k]['id']}";
					}
				}
			}
			$this->smarty->assign("navinfo",$navinfo);
		}
		$flashinfo = unserialize(base64_decode($view["flash"]));
		if(!empty($flashinfo)){
			foreach($flashinfo as $k=>$v){
                if(!empty($v["id"])) {
                    $finfo = $this->vqconn->viewdata("*", "flash", "where token='{$usertoken}' and id={$v['id']}");
                    $flashinfo[$k]["pic"] = $finfo["img"];
                    if (empty($flashinfo[$k]["url"])) {
                        $flashinfo[$k]["url"] = $finfo["url"];
                    }
                }
			}
			$this->smarty->assign("flashinfo",$flashinfo);
		}
		if(!empty($view["news"])){
			$newsinfo = unserialize(base64_decode($view["news"]));
			foreach($newsinfo as $k=>$v){
				if(!empty($v["id"])){
					if($v["url"]=='list'){
						$temp = $this->vqconn->viewdata("id,name,img","classify","where id={$v['id']}");
						$newsinfo[$k]["title"] = $temp["name"];
						$newsinfo[$k]["pic"] = $temp["img"];
						$newsinfo[$k]["text"] = '';
						$newsinfo[$k]["tim"] = date("Y-m-d",time());
						$newsinfo[$k]["url"] = "?g=pc&a=showlist&u={$userid}&cid=".$v["id"];
					}else{
						$temp = $this->vqconn->viewdata("id,title,pic,text,createtime","img","where id={$v['id']}");
						$newsinfo[$k]["title"] = $temp["title"];
						$newsinfo[$k]["pic"] = $temp["pic"];
						$newsinfo[$k]["text"] = $temp["text"];
						$newsinfo[$k]["tim"] = date("Y-m-d",$temp["createtime"]);
						$newsinfo[$k]["url"] = "?g=pc&a=showview&u={$userid}&id=".$v["id"];
					}
				}
			}
			$this->smarty->assign("newsinfo",$newsinfo);
		}else{
			$newsinfo = $this->vqconn->arrdata("*","img","where token='{$usertoken}'","id desc","limit 5");
			$this->smarty->assign("newsinfo",$newsinfo);
		}
		if(!empty($view["ad"])){
			$adinfo = unserialize(base64_decode($view["ad"]));
			$this->smarty->assign("adinfo",$adinfo);  
		}
		if(empty($view["rcode"])){
			$url=$vqbasehost."?g=Wap&token={$usertoken}&pla=4";
			$rcode=$this->getrcode($url);
			$rcodeimg = $this->upload($this->basehost.$rcode);
			$this->updata("pcindex","rcode='".$rcodeimg["pic"]."'","where userid={$userid}");
			$view["rcode"] = $rcodeimg["pic"];
		}
		$styleinfo = $this->viewdata("*","pctpl","where userid={$userid}");
		$tid = empty($styleinfo["tid"])?1:$styleinfo["tid"];
		$company = $this->viewdata("*","company","where userid={$userid}");
		$this->smarty->assign("company",$company);
		$this->smarty->assign("view",$view);
		$this->smarty->assign("u",$userid);
		$this->smarty->display("pcindex{$tid}.tpl");
	}
	public function showlist(){
		$userid=intval($_GET["u"]);
		if(!empty($_GET["cid"])){
			$cid=intval($_GET["cid"]);
			$cinfo = $this->vqconn->viewdata("*","classify","where id={$cid}");
			$this->smarty->assign("cinfo");
		}
		$usertoken = $this->oncedata("token","users","where id={$userid}");
		$urlhost = empty($_SERVER["SERVER_NAME"])?$_SERVER["HTTP_HOST"]:$_SERVER["SERVER_NAME"];
		if($urlhost == 'qiyue.zhongsou.com' || $urlhost=='qiyuenew.zhongsou.com'){
			$vqbasehost = 'http://vq.zhongsou.com/';
		}else{
			$vqbasehost = 'http://kaifa.vq.zhongsou.com/';
		}
		$view = $this->viewdata("*","pcindex","where userid={$userid}");
		if(empty($view)){
			header("location:".$this->basehost);
			exit;
		}
		if(empty($view["indextit"])){$view["indextit"]='首页';}
		if(empty($view["listtit"])){$view["listtit"]='行业资讯';}
		$navinfo = unserialize(base64_decode($view["nav"]));
		if(!empty($navinfo)){
			foreach($navinfo as $k=>$v){
				if(!empty($navinfo[$k]["id"])){
					if($navinfo[$k]["url"]=='list'){
						$navinfo[$k]["url"] = "?g=pc&a=showlist&u={$userid}&cid={$navinfo[$k]['id']}";
					}elseif(!empty($v['id'])){
						$navinfo[$k]["url"] = "?g=pc&a=showview&u={$userid}&id={$navinfo[$k]['id']}";
					}
				}
			}
			$this->smarty->assign("navinfo",$navinfo);
		}
		$flashinfo = unserialize(base64_decode($view["flash"]));
		if(!empty($flashinfo)){
			foreach($flashinfo as $k=>$v){
				$finfo = $this->vqconn->viewdata("*","flash","where token='{$usertoken}' and id={$v['id']}");
				$flashinfo[$k]["pic"] = $finfo["img"];
				if(empty($flashinfo[$k]["url"])){$flashinfo[$k]["url"]=$finfo["url"];}
			}
			$this->smarty->assign("flashinfo",$flashinfo);
		}
		if(!empty($view["news"])){
			$newsinfo = unserialize(base64_decode($view["news"]));
			foreach($newsinfo as $k=>$v){
				if(!empty($v["id"])){
					if($v["url"]=='list'){
						$temp = $this->vqconn->viewdata("id,name,img","classify","where id={$v['id']}");
						$newsinfo[$k]["title"] = $temp["name"];
						$newsinfo[$k]["pic"] = $temp["img"];
						$newsinfo[$k]["text"] = '';
						$newsinfo[$k]["tim"] = date("Y-m-d",time());
						$newsinfo[$k]["url"] = "?g=pc&a=showlist&u={$userid}&cid=".$v["id"];
					}else{
						$temp = $this->vqconn->viewdata("id,title,pic,text,createtime","img","where id={$v['id']}");
						$newsinfo[$k]["title"] = $temp["title"];
						$newsinfo[$k]["pic"] = $temp["pic"];
						$newsinfo[$k]["text"] = $temp["text"];
						$newsinfo[$k]["tim"] = date("Y-m-d",$temp["createtime"]);
						$newsinfo[$k]["url"] = "?g=pc&a=showview&u={$userid}&id=".$v["id"];
					}
				}
			}
			$this->smarty->assign("newsinfo",$newsinfo);
		}else{
			$newsinfo = $this->vqconn->arrdata("*","img","where token='{$usertoken}'","id desc","limit 5");
			$this->smarty->assign("newsinfo",$newsinfo);
		}
		if(!empty($view["ad"])){
			$adinfo = unserialize(base64_decode($view["ad"]));
			$this->smarty->assign("adinfo",$adinfo);  
		}
		if(empty($view["rcode"])){
			$url=$vqbasehost."?g=Wap&pla=4&token={$usertoken}";
			$rcode=$this->getrcode($url);
			$rcodeimg = $this->upload($this->basehost.$rcode);
			$this->updata("pcindex","rcode='".$rcodeimg["pic"]."'","where userid={$userid}");
			$view["rcode"] = $rcodeimg["pic"];
		}
		$styleinfo = $this->viewdata("*","pctpl","where userid={$userid}");
		$tid = empty($styleinfo["tid"])?1:$styleinfo["tid"];
		$company = $this->viewdata("*","company","where userid={$userid}");
		$this->smarty->assign("company",$company);
		$this->smarty->assign("view",$view);
		$this->smarty->assign("u",$userid);
		$listinfo = $this->viewdata("*","pclist","where userid={$userid}");
		$this->smarty->assign("listinfo",$listinfo);
		$where="where token='{$usertoken}'";
		$sort[]="g=pc";
		$sort[]="a=showlist";
		$sort[]="u={$userid}";
		if(!empty($cid)){
			$where.=" and classid={$cid}";
			$sort[]="cid={$cid}";
		}
		$page = empty($_GET["page"])?1:intval($_GET["page"]);
		$pagesize = empty($listinfo["pagesize"])?20:intval($listinfo["pagesize"]);
		$pagenum = ($page - 1) * $pagesize;
		$list = $this->vqconn->arrdata("*","img",$where,"id desc","limit {$pagenum},{$pagesize}");
		foreach($list as $k=>$v){
			$list[$k]["tim"] = date("Y-m-d",$list[$k]["createtime"]);
		}
		$pagestr = $this->vqconn->termpage("img",$where,$sort,$page,$pagesize);
		$this->smarty->assign("list",$list);
		$this->smarty->assign("pagestr",$pagestr);
		$this->smarty->display("pclist{$tid}.tpl");
	}
	public function showview(){
		$userid=intval($_GET["u"]);
		$id=intval($_GET["id"]);
		$usertoken = $this->oncedata("token","users","where id={$userid}");
		$urlhost = empty($_SERVER["SERVER_NAME"])?$_SERVER["HTTP_HOST"]:$_SERVER["SERVER_NAME"];
		if($urlhost == 'qiyue.zhongsou.com' || $urlhost=='qiyuenew.zhongsou.com'){
			$vqbasehost = 'http://vq.zhongsou.com/';
		}else{
			$vqbasehost = 'http://kaifa.vq.zhongsou.com/';
		}
		$view = $this->viewdata("*","pcindex","where userid={$userid}");
		if(empty($view)){
			header("location:".$this->basehost);
			exit;
		}
		if(empty($view["indextit"])){$view["indextit"]='首页';}
		if(empty($view["listtit"])){$view["listtit"]='行业资讯';}
		$navinfo = unserialize(base64_decode($view["nav"]));
		if(!empty($navinfo)){
			foreach($navinfo as $k=>$v){
				if(!empty($navinfo[$k]["id"])){
					if($navinfo[$k]["url"]=='list'){
						$navinfo[$k]["url"] = "?g=pc&a=showlist&u={$userid}&cid={$navinfo[$k]['id']}";
					}elseif(!empty($v['id'])){
						$navinfo[$k]["url"] = "?g=pc&a=showview&u={$userid}&id={$navinfo[$k]['id']}";
					}
				}
			}
			$this->smarty->assign("navinfo",$navinfo);
		}
		$flashinfo = unserialize(base64_decode($view["flash"]));
		if(!empty($flashinfo)){
			foreach($flashinfo as $k=>$v){
				$finfo = $this->vqconn->viewdata("*","flash","where token='{$usertoken}' and id={$v['id']}");
				$flashinfo[$k]["pic"] = $finfo["img"];
				if(empty($flashinfo[$k]["url"])){$flashinfo[$k]["url"]=$finfo["url"];}
			}
			$this->smarty->assign("flashinfo",$flashinfo);
		}
		if(!empty($view["news"])){
			$newsinfo = unserialize(base64_decode($view["news"]));
			foreach($newsinfo as $k=>$v){
				if(!empty($v["id"])){
					if($v["url"]=='list'){
						$temp = $this->vqconn->viewdata("id,name,img","classify","where id={$v['id']}");
						$newsinfo[$k]["title"] = $temp["name"];
						$newsinfo[$k]["pic"] = $temp["img"];
						$newsinfo[$k]["text"] = '';
						$newsinfo[$k]["tim"] = date("Y-m-d",time());
						$newsinfo[$k]["url"] = "?g=pc&a=showlist&u={$userid}&cid=".$v["id"];
					}else{
						$temp = $this->vqconn->viewdata("id,title,pic,text,createtime","img","where id={$v['id']}");
						$newsinfo[$k]["title"] = $temp["title"];
						$newsinfo[$k]["pic"] = $temp["pic"];
						$newsinfo[$k]["text"] = $temp["text"];
						$newsinfo[$k]["tim"] = date("Y-m-d",$temp["createtime"]);
						$newsinfo[$k]["url"] = "?g=pc&a=showview&u={$userid}&id=".$v["id"];
					}
				}
			}
			$this->smarty->assign("newsinfo",$newsinfo);
		}else{
			$newsinfo = $this->vqconn->arrdata("*","img","where token='{$usertoken}'","id desc","limit 5");
			$this->smarty->assign("newsinfo",$newsinfo);
		}
		if(!empty($view["ad"])){
			$adinfo = unserialize(base64_decode($view["ad"]));
			$this->smarty->assign("adinfo",$adinfo);  
		}
		if(empty($view["rcode"])){
			$url=$vqbasehost."?g=Wap&pla=4&token={$usertoken}";
			$rcode=$this->getrcode($url);
			$rcodeimg = $this->upload($this->basehost.$rcode);
			$this->updata("pcindex","rcode='".$rcodeimg["pic"]."'","where userid={$userid}");
			$view["rcode"] = $rcodeimg["pic"];
		}
		$styleinfo = $this->viewdata("*","pctpl","where userid={$userid}");
		$tid = empty($styleinfo["tid"])?1:$styleinfo["tid"];
		$company = $this->viewdata("*","company","where userid={$userid}");
		$this->smarty->assign("company",$company);
		$this->smarty->assign("view",$view);
		$this->smarty->assign("u",$userid);
		$coninfo = $this->viewdata("*","pccon","where userid={$userid}");
		$this->smarty->assign("coninfo",$coninfo);
		$info = $this->vqconn->viewdata("*","img","where id={$id}");
		$info["info"] = html_entity_decode(stripslashes($info["info"]));
		$info["tim"] = date("Y-m-d",$info["createtime"]);
		$info["info"] = str_replace('"/uploads/','"'.$vqbasehost.'uploads/',$info["info"]);
		$this->smarty->assign("info",$info);
		$this->smarty->display("pcview{$tid}.tpl");
	}
	
	//内容页设置
	public function setcon(){
		if(!empty($_POST)){
			$isclass=intval($_POST["isclass"]);
			$ispic=intval($_POST["ispic"]);
			$iswriter=intval($_POST["iswriter"]);
			$istim=intval($_POST["istim"]);
			$into="userid={$this->userinfo['userid']},isclass={$isclass},ispic={$ispic},iswriter={$iswriter},istim={$istim}";
			$ishave=$this->viewdata("id","pccon","where userid={$this->userinfo['userid']}");
			if(!empty($ishave)){
				$this->updata("pccon",$into,"where id={$ishave['id']}");
			}else{
				$this->setdata("pccon",$into);
			}
			die(jsfshow('内容页设置完成'));
		}
		$this->smarty->assign("tit","内容页设置");
		$view = $this->viewdata("*","pccon","where userid={$this->userinfo['userid']}");
		if(!empty($view)){$this->smarty->assign("view",$view);}
		$this->smarty->assign("navstyle",array("con"=>'class="sel"'));
		$this->smarty->assign("pla",$this->pla);
		$this->smarty->assign("planame",$this->plarr[$this->pla]);
		$this->smarty->display("setcon.tpl");
	}
	//获得文章列表
	public function getnews(){
		$cid=intval($_GET["cid"]);
		$usertoken = $this->oncedata("token","users","where id={$this->userinfo['userid']}");
		$list = $this->vqconn->arrdata("id,title","img","where token='{$usertoken}' and classid={$cid}");
		if(!empty($list)){
			$urlhost = empty($_SERVER["SERVER_NAME"])?$_SERVER["HTTP_HOST"]:$_SERVER["SERVER_NAME"];
			if($urlhost == 'qiyue.zhongsou.com' || $urlhost=='qiyuenew.zhongsou.com'){
				$vqbasehost = 'http://vq.zhongsou.com/';
			}else{
				$vqbasehost = 'http://kaifa.vq.zhongsou.com/';
			}
			foreach($list as $k=>$v){
				if(empty($list[$k]["url"])){
					$list[$k]["url"]=$vqbasehost."?g=Wap&a=content&token={$usertoken}&id={$v['id']}";
				}
			}
		}
		echo json_encode($list);
		exit;
	}
	//获得文章分类
	public function getclass(){
		$usertoken = $this->oncedata("token","users","where id={$this->userinfo['userid']}");
		$clist = $this->vqconn->arrdata("id,name","classify","where token='{$usertoken}' and fid=0");
		echo json_encode($clist);
		exit;
	}
	//获得轮播图
	public function getflash(){
		$usertoken = $this->oncedata("token","users","where id={$this->userinfo['userid']}");
		$list = $this->vqconn->arrdata("*","flash","where token='{$usertoken}' and tip=1");
		if(!empty($list)){
			foreach($list as $k=>$v){
				if(empty($list[$k]["info"])){
					$list[$k]["info"]='未命名';
				}else{
					$list[$k]["info"] = $this->cutstr_utf8($list[$k]["info"],'50','..');
				}
				if(empty($list[$k]["url"])){$list[$k]["url"]=$list[$k]["img"];}
			}
		}
		echo json_encode($list);
		exit;
	}
}